package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	filename := "doc/write_01.txt"
	file, err := os.OpenFile(filename, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0666)
	if err != nil {
		fmt.Println("create file error.", err)
		return
	}
	defer file.Close()
	writer := bufio.NewWriter(file)
	content := "hello你好\n"
	for i := 0; i < 10; i++ {
		writer.WriteString(content)
	}
	writer.Flush()
}
